Graphing all the environmental data together. The data sets here have had the outliers removed and are hourly medians.

Set up

rm(list=ls())

library(tidyverse)
library(ggpubr)
library(scales)
library(chron)
library(plotly)
library(taRifx)
library(aweek)
library(easypackages)
library(renv)
library(here)
library(ggthemes)
library(gridExtra)
library(patchwork)
library(tidyquant)
library(recipes) 
library(cranlogs)
library(knitr)
library(openair)

Salinity

cc.sal<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/cc_sal.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
eos.sal<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/eos_sal.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
rb.sal<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/rb_sal.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
fp.sal<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/fp_sal.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)

cc.sal$date<-as.POSIXct(cc.sal$date, format = c("%Y-%m-%d"))
eos.sal$date<-as.POSIXct(eos.sal$date, format = c("%Y-%m-%d"))
rb.sal$date<-as.POSIXct(rb.sal$date, format = c("%Y-%m-%d"))
fp.sal$date<-as.POSIXct(fp.sal$date, format = c("%Y-%m-%d"))

cc.sal.g<-cc.sal%>%
  ggplot(aes(x=date, y=salinity, color=salinity))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median salinity from China Camp",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")
eos.sal.g<-eos.sal%>%
  ggplot(aes(x=date, y=salinity, color=salinity))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median salinity from EOS research pier",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")
rb.sal.g<-rb.sal%>%
  ggplot(aes(x=date, y=salinity, color=salinity))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median salinity from Richardson Bay",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")
fp.sal.g<-fp.sal%>%
  ggplot(aes(x=date, y=salinity, color=salinity))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median salinity from Fort Point",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")
sal.all<-ggarrange(cc.sal.g, eos.sal.g, rb.sal.g, fp.sal.g, ncol=4, nrow=1)
## Warning: Removed 4563 rows containing missing values (geom_point).
## Warning: Removed 314 rows containing missing values (geom_point).
## Warning: Removed 6903 rows containing missing values (geom_point).
## Warning: Removed 3117 rows containing missing values (geom_point).
sal.all

pH

cc.ph<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/cc_ph.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
eos.ph<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/eos_ph.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
rb.ph<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/rb_ph.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
#no fort point ph data

cc.ph$date<-as.POSIXct(cc.ph$date, format = c("%Y-%m-%d"))
eos.ph$date<-as.POSIXct(eos.ph$date, format = c("%Y-%m-%d"))
rb.ph$date<-as.POSIXct(rb.ph$date, format = c("%Y-%m-%d"))

cc.ph.g<- cc.ph %>% ggplot(aes(x=date, y=ph, color=ph))+
  geom_point(alpha=0.5)+ylim(6.5,9)+
  labs(title="Hourly median pH from China Camp",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")

eos.ph.g<-eos.ph %>% ggplot(aes(x=date, y=ph, color=ph))+
  geom_point(alpha=0.5)+ylim(6.5,9)+
  labs(title="Hourly median pH from EOS research pier",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")

rb.ph.g<-rb.ph%>% ggplot(aes(x=date, y=ph, color=ph))+
  geom_point(alpha=0.5)+ylim(6.5,9)+
  labs(title="Hourly median pH from Richardson Bay",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")

#just using this to create a blank plot since there is no data
fp.ph.g<-rb.ph%>%ggplot(aes(x=date, y=ph, color=ph))+
  geom_point(alpha=0)+ylim(6.5,9)+
  labs(title="No ph data at Fort Point",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")

ph.all<-ggarrange(cc.ph.g, eos.ph.g, rb.ph.g, fp.ph.g, ncol=4, nrow=1)
## Warning: Removed 14445 rows containing missing values (geom_point).
## Warning: Removed 588 rows containing missing values (geom_point).
## Warning: Removed 13264 rows containing missing values (geom_point).

## Warning: Removed 13264 rows containing missing values (geom_point).
ph.all

Dissolved Oxygen

cc.do<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/cc_do.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
eos.do<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/eos_do.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
rb.do<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/rb_do.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
#no fort point do data

cc.do$date<-as.POSIXct(cc.do$date, format = c("%Y-%m-%d"))
eos.do$date<-as.POSIXct(eos.do$date, format = c("%Y-%m-%d"))
rb.do$date<-as.POSIXct(rb.do$date, format = c("%Y-%m-%d"))

cc.do.g<- cc.do %>% ggplot(aes(x=date, y=do, color=do))+
  geom_point(alpha=0.5)+ylim(0,25)+
  labs(title="Hourly median dissolved oxygen from China Camp",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")

eos.do.g<-eos.do %>% ggplot(aes(x=date, y=odo, color=odo))+
  geom_point(alpha=0.5)+ylim(0,25)+
  labs(title="Hourly median dissolved oxygen from EOS research pier",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")

rb.do.g<-rb.do%>% ggplot(aes(x=date, y=do, color=do))+
  geom_point(alpha=0.5)+ylim(0,25)+
  labs(title="Hourly median dissolved oxygen from Richardson Bay",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")
#just using this to create a blank plot since there is no data
fp.do.g<-rb.do%>%ggplot(aes(x=date, y=do, color=do))+
  geom_point(alpha=0)+ylim(0,25)+
  labs(title="No dissolved oxygen data at Fort Point",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")

do.all<-ggarrange(cc.do.g, eos.do.g, rb.do.g, fp.do.g, ncol=4, nrow=1)
## Warning: Removed 1857 rows containing missing values (geom_point).
## Warning: Removed 231 rows containing missing values (geom_point).
## Warning: Removed 2102 rows containing missing values (geom_point).

## Warning: Removed 2102 rows containing missing values (geom_point).
do.all

Water temperature

cc.watertemp<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/cc_watertemp.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
eos.watertemp<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/eos_watertemp.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
rb.watertemp<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/rb_watertemp.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)
fp.watertemp<-read.csv("C:/Users/chels/Box Sync/Thesis/Data/Working data/Bouy data/fp_watertemp.csv", header = TRUE, sep=",", fileEncoding="UTF-8-BOM", stringsAsFactors = FALSE)

cc.watertemp$date<-as.POSIXct(cc.watertemp$date, format = c("%Y-%m-%d"))
eos.watertemp$date<-as.POSIXct(eos.watertemp$date, format = c("%Y-%m-%d"))
rb.watertemp$date<-as.POSIXct(rb.watertemp$date, format = c("%Y-%m-%d"))
fp.watertemp$date<-as.POSIXct(fp.watertemp$date, format = c("%Y-%m-%d"))

cc.watertemp.g<-cc.watertemp%>%
  ggplot(aes(x=date, y=water_temp, color=water_temp))+
  geom_point(alpha=0.5)+ylim(5,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median water tempuature from China Camp",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")
eos.watertemp.g<-eos.watertemp%>%
  ggplot(aes(x=date, y=temperature, color=temperature))+
  geom_point(alpha=0.5)+ylim(5,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median water tempurature from EOS research pier",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")
rb.watertemp.g<-rb.watertemp%>%
  ggplot(aes(x=date, y=water_temp, color=water_temp))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median water tempurature from Richardson Bay",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of NERR")
fp.watertemp.g<-fp.watertemp%>%
  ggplot(aes(x=date, y=water_temp, color=water_temp))+
  geom_point(alpha=0.5)+ylim(0,35)+
  geom_hline(yintercept=10, linetype="dashed", color = "red")+
  labs(title="Hourly median water temperature from Fort Point",
       subtitle="01/01/2017 - 12/31/2019",
       caption= "data courtesy of CeNCOOS")

watertemp.all<-ggarrange(cc.watertemp.g, eos.watertemp.g, rb.watertemp.g, fp.watertemp.g, ncol=4, nrow=1)
## Warning: Removed 921 rows containing missing values (geom_point).
## Warning: Removed 513 rows containing missing values (geom_point).
## Warning: Removed 1901 rows containing missing values (geom_point).
## Warning: Removed 3315 rows containing missing values (geom_point).
watertemp.all

All together

ggarrange(sal.all, ph.all, do.all, watertemp.all, nrow=4, ncol=1)

Need to clean up and fix aesthtics and verify some of the data points.